﻿using System;
using System.Collections.Generic;
using SobrietyEngine.UDMF;
using SobrietyEngine.Actor;
using SobrietyEngine.Components.Common;
using SobrietyEngine.Components.Physics;
using SobrietyEngine.Physics;
using SobrietyEngine.Scene;
using Microsoft.Xna.Framework;

namespace SobrietyEngine.Actor.Builders.UDMF
{
    public class UDMFWallBldr:BaseActorBuilder
    {
        public static IActor Build(IScene scene, Vector3 p1, Vector3 p2)
        {
            IActor actor = scene.CreateEmptyActor();
            actor.AttachComponent(new PositionCmp(new Vector3(0, 0, 0)));

            FarseerPhysicsCmp pb = new EdgeBodyCmp(scene.Name, p1, p2);
            pb.Enabled = true;
            pb.IsStatic = true;
            actor.AttachComponent(pb);

            actor.Initialize();

            pb.Body.CollisionCategories = CollisionCatagories.GroundIs;
            pb.Body.CollidesWith = CollisionCatagories.GroundHits;

            return actor;
        }
    }
}
